Script Exit Codes

Script exit codes are the vehicle by which the Orbital node informs Orbital how a given executing Python script has completed, whether it was successful or not.

Scripts return an exit code using the sys.exit() function. A zero (0) will be returned if the script completed successfully. A non-zero exit code will be returned if the script failed, producing an error. For example:

fname = "some_file"

try:

f = open(fname, 'rb')

# use the file

sys.exit(0) # success

except OSError:

print("Could not open/read file:", fname)

sys.exit(1) # non-zero - error

 

Note: If a script fails, it will be identified as returning an error in the results listing, similar to the one shown in the figure below.

Special Orbital Exit Codes

Customers can make use of exit codes that range from zero (0) to 199. Exit codes 200 and greater are reserved for Orbital internal use only and should not be used in customer scripts.

Code Description
0 Script Successfully Executed
1-199 Available to Customer Scripts
200 Script Timed Out
201 Orbital Error
202 Python Execution Error
203 Script Exception Occurred
204 Script Failed to Run
205 Script Feature Not Enabled
206 Python Missing from Node
207 Node Feature Update In Progress or OS Mismatch

Using stderr In Scripts

In those instances where the script returns non-fatal errors or warning conditions, you are encouraged to write them to stderr.

For example:

fname = "some_file"

try:

f = open(fname, 'rb')

# use the file

sys.exit(0) # success

except OSError:

print("warning - could not open/read file", file=sys.stderr)

# continue...

sys.exit(0) # still success

More Info